<?php


namespace App\Http\Controllers\android\service;


use App\Http\Controllers\utils\ToolUtil;
use Illuminate\Support\Facades\DB;


class FileService
{


    /**
     * 获取小程序二维码
     * @param $param
     * @return false|string
     */
    public static function getAppletQrCode($param){
        $data = DB::table('t_file')->where(['type'=>1])->first(['file']);
        if($data){
            return ToolUtil::returnJson(200,'成功',$data);
        }
        return ToolUtil::returnJson(400,'没有数据');
    }


    /**
     * 获取文件
     * @param $param
     * @return false|string
     */
    public static function getFiles($param){
        $type = (int)$param['type'];
        $data = DB::table('t_file')->where(['type'=>$type])->first(['type','file']);
        if($data){
            $data['type'] = ToolUtil::getFileTypeName($data['type']);
            return ToolUtil::returnJson(200,'成功',$data);
        }
        return ToolUtil::returnJson(400,'没有数据');
    }



}
